package org.tgcms.core.dal.appengine.domain;

import javax.jdo.annotations.Extension;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;
import javax.jdo.annotations.Version;
import javax.jdo.annotations.VersionStrategy;

import org.tgcms.core.dal.dto.Template;

import com.google.appengine.api.datastore.Key;

@PersistenceCapable(detachable="true")
@Version(strategy = VersionStrategy.VERSION_NUMBER, column = "version", extensions = { @Extension(vendorName = "datanucleus", key = "field-name", value = "version") })
public class AppengineTemplate implements AppengineEntity, Template {

	@PrimaryKey
	private Key key;

	private Long version;

	@Persistent
	private String name;

	@Persistent
	private String contentType;

	@Persistent
	private String html;

	public AppengineTemplate(Key key) {
		this.key = key;
	}
	
//	public AppengineTemplate(Template t) {
//		this.name = t.getName();
//		this.contentType = t.getContentType();
//		this.html = t.getContentType();
//	}
	
	public Key getKey() {
		return key;
	}

	public void setKey(Key key) {
		this.key = key;
	}

	public Long getVersion() {
		return version;
	}

	public void setVersion(Long version) {
		this.version = version;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getContentType() {
		return contentType;
	}

	public void setContentType(String contentType) {
		this.contentType = contentType;
	}

	public String getHtml() {
		return html;
	}

	public void setHtml(String html) {
		this.html = html;
	}

}
